﻿#ifdef xxxx
#pragma once

#include <sys/socket.h>
#include <bits/sockaddr.h>
namespace SocketOp
{
    using socket_t = int;

    socket_t create(sa_family_t family);

    void close(socket_t socket_fd);
    
    int connect(socket_t socket_fd, const struct sockaddr_in &sa);

    void bind(socket_t socket_fd, const struct sockaddr* addr);

    ssize_t write(socket_t socket_fd, const void* buf, size_t buf_len);
    
    ssize_t read(socket_t socket_fd, void* buf, size_t buf_len);

    ssize_t shutdown_write(socket_t socket_fd);

    int socketpair(socket_t fds[2], int domain = AF_UNIX, int type = SOCK_STREAM, int protocol = 0);
}

#endif // xxxx